package com.helloandroid.paso.ui.news;

import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.webkit.WebChromeClient;

public class News{
	
	//TODO Tamas: loading of html content is too slow, may cause ANR. Use a thread to download 
	//TODO the html file, than load it in the webview. See utils package, for asynctask example.
	
	// TODO: NEW! Disable webview while loading.
	// TODO: NEW! Remove "New Concerts" and remove menu too.

	
	/**
	 * getNews((WebView) findViewById(R.id.vView), R.string.newsURL, (ProgressBar) findViewById(R.id.wVProgress));
	 */
	public void getNews(WebView wView, String url,final ProgressBar pB) {

		wView.setWebViewClient(new WebViewClient()); 
		
		wView.setWebChromeClient(new WebChromeClient() {
			public void onProgressChanged(WebView view, int progress) {

				if (progress == 100)
					pB.setVisibility(View.GONE);
			}
		});
		
		wView.loadUrl(url);
	}
}
